<?php

class RecentController extends Zend_Controller_Action
{
    protected $articleModel;
    protected $eventModel;

    protected function getArticleModel() {
        if(is_null($this->articleModel)) {
            require_once 'Article.php';
            $this->articleModel = new Article();
        }

        return $this->articleModel;
    }

    protected function getEventModel() {
        if(is_null($this->eventModel)) {
            require_once 'Event.php';
            $this->eventModel = new Event();
        }

        return $this->eventModel;
    }
    
    public function init()
    {
        $this->view->controleur="recent";
    }

    public function indexAction()
    {
        $this->view->articleList = $this->getArticleModel()->getLatestArticle(10);
        $this->view->eventList = $this->getEventModel()->getLatestEvent(10);
    }
}

